package com.beself.service.impl;

import com.beself.dao.TJourneyMapper;
import com.beself.entity.TModule;
import com.beself.entity.TRoute;
import com.beself.entity.TTask;
import com.beself.service.JourneyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ProjectName: beself
 * @Package: com.beself.service.impl
 * @ClassName: JourneyServiceImpl
 * @Description: java类作用描述
 * @Author: 樊晋源
 * @CreateDate: 2019/10/16 9:56
 * @Version: 1.0
 */
@Service
public class JourneyServiceImpl implements JourneyService {
    @Resource
    private TJourneyMapper tJourneyMapper;

    //查询所有旅程线路
    @Override
    public List<TRoute> findroutes() {
        return tJourneyMapper.findroutes();
    }
    //查询该用户下面每个线路的各完成多少任务，
    @Override
    public int findachievement(int uId, int i) {
        Map map = new HashMap();
        map.put("utuid",uId);
        map.put("utroute",i);
        return tJourneyMapper.findachievement(map);
    }
    //查询每个线路所有模块
    @Override
    public List<TModule> findmodules(int i) {
        return tJourneyMapper.findmodules(i);
    }
    //查询每个模块下所有的任务
    @Override
    public List<TTask> findtasks(int i) {
        return tJourneyMapper.findtasks(i);
    }
    //打卡
    @Override
    public int clock(int uId, int routeId, int taskId) {
        Map map = new HashMap();
        map.put("uid",uId);
        map.put("routeid",routeId);
        map.put("taskid",taskId);
        return tJourneyMapper.clock(map);
    }
}
